﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="System.Collections.Generic" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	固定位置列表
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <% 
        IEnumerable<Position> positions = (IEnumerable<Position>)ViewData["positions"];
        User user = (User)ViewData["user"];
    %>
    <% using (Html.BeginForm()) {%>
    <label>请选择堆场/尾矿库：</label><span id="stackList"><%= Html.DropDownList("stackId", ViewData["stacksAndTailingponds"] as List<SelectListItem>, "请选择", new { onchange = "submit();" })%></span>
    <%} %>
    <table class="style_table2" cellpadding="4" cellspacing="0" border="0" style="margin-top:20px;width:1000px;">
       <tr>
    	    <th style="width:60px; text-align:center;">编号</th>
    	    <th style="text-align:center;">位置名称</th>
    	    <th style="width:160px; text-align:center;">开始记录时间</th>
		    <th style="width:160px; text-align:center;">最近记录时间</th>
            <% if (user.RoleId != (int)RoleEnum.Recorder) { %>
            <th style="width:160px; text-align:center;">是否已停止上传</th>
            <%} %>
	    <th style="width:150px; text-align:center;">操作</th>
 	    </tr>
        <% 
            int i = 0;
            foreach (var item in positions)
            {
                i++; 
        %>
	    <tr onmouseover="this.className='trbgmouseover'"  onmouseout="this.className='trmouseout' ">
	        <td style="text-align:center;"><%= i %></td>
            <td> <%= item.Name %></td>
		    <td style="text-align:center;"> <%= item.FirstUploadDate.HasValue ? item.FirstUploadDate.Value.ToString("yyyy-MM-dd") : "&nbsp;"%></td>
            <td style="text-align:center;"> <%= item.LastUploadDate.HasValue ? item.LastUploadDate.Value.ToString("yyyy-MM-dd") : "&nbsp;"%></td>
            <% if (user.RoleId != (int)RoleEnum.Recorder) { %>
            <td style="text-align:center;"> <%= item.Status ? "是" : "&nbsp;" %></td>
            <%} %>
		    <td style="margin-left:15px;text-align:center;">
                <% if (user.RoleId == (int)RoleEnum.Recorder && !item.Status) { %>
                <%= Html.ActionLink("图片上传", "AddPositionPicture", new { positionId = item.Id }, new { style = "margin-left:15px" })%>
                <%} %>
                <%if (item.LastUploadDate.HasValue) { %>
                <%= Html.ActionLink("查看", "Detail", new { positionId = item.Id })%>
                <%} %>
            </td>
        </tr>
        <%} %>
    </table>
</asp:Content>